<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="com.model.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>
<%@ include file="/header.jsp"%>
<style>
* {font-family: "宋体";font-size: 14px}
</style>
<p align="right">
	<c:if test="${!empty loginUser}">
	        登录名：${loginUser.username} &nbsp;&nbsp;&nbsp;&nbsp;
	    <a href="${ctx}/user/editUserPassword.jsp">修改密码</a>
	    <a href="${ctx}/user/loginOut">注销</a>
        <center> 
	    <a href="${ctx}/message/addMessage.jsp">添加留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	    <c:if test="${function=='all'}">
	    	<a href="${ctx}/message/show?function=my">我的留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	    </c:if>
	    <c:if test="${function!='all'}">
	    	<a href="${ctx}/message/show?function=all">所有留言</a>&nbsp;&nbsp;&nbsp;&nbsp;
	    </c:if>
        <center> 
	</c:if>
	<c:if test="${empty loginUser}">
	    <a href="${ctx}/user/login.jsp">登录</a>
	    <a href="${ctx}/user/register.jsp">注册</a>
	</c:if>
	<br>
</p>${loginUser.roleId}
	    <c:if test="${loginUser.roleId==1}">
	    <a href="${ctx}/user/show">用户管理</a>
	    </c:if>
	留言内容<br><br>
	<c:forEach var="obj" items="${mslist.data}" >
		
	<table width="600" border="1" bordercolor="000000"
		style="table-layout: fixed; word-break: break-all">
		<tr>
			<td width="100" bordercolor="ffffff">
				编号:
			</td>
			<td width="500" bordercolor="ffffff">${obj.id}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">
				姓名:
			</td>
			<td bordercolor="ffffff">${obj.name}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">
				电话:
			</td>
			<td bordercolor="ffffff">${obj.phone}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">
				email:
			</td>
			<td bordercolor="ffffff">${obj.email}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">
				主题:
			</td>
			<td bordercolor="ffffff">${obj.title}</td>
		</tr>
		<tr>
			<td valign="top" bordercolor="ffffff">
				内容:
			</td>
			<td valign="top" bordercolor="ffffff">${obj.content}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">
				时间:
			</td>
			<td bordercolor="ffffff">${obj.time}</td>
		</tr>
		<tr>
			<td bordercolor="ffffff">
				操作:
			</td>
			<td bordercolor="ffffff">
	    <c:if test="${loginUser.username==obj.name || loginUser.roleId==1}">
			<a href="${ctx}/message/delete?id=${obj.id}">删除</a>
			<a href="${ctx}/message/edit?id=${obj.id}">修改</a>
		</c:if>
			</td>
		</tr>
	</table>
	<br>
	</c:forEach>
		<pg:pager url="show"	items="${mslist.maxRows}"	maxPageItems="${mslist.pageSize}"  maxIndexPages="5">
		<pg:index>
			<pg:first unless="current">
				<a href="${pageUrl}&pageNumber=${pageNumber}">首页</a>
			</pg:first>
			<pg:prev>
				<a href="${pageUrl}&pageNumber=${pageNumber}">上一页(${pageNumber})</a>
			</pg:prev>
			<pg:pages>
				<a href="${pageUrl}&pageNumber=${pageNumber}">${pageNumber}</a>				
			</pg:pages>
			<pg:next>
				<a href="${pageUrl}&pageNumber=${pageNumber}">下一页(${pageNumber})</a>
			</pg:next>
			<pg:last unless="current">
				<a href="${pageUrl}&pageNumber=${pageNumber}">尾页</a>
			</pg:last>
		</pg:index>
	</pg:pager>
</center>
<%@ include file="/footer.htm"%>